import { shallowRef, watch } from 'vue'
import { getRemember, setCache } from '../index'


export const useRemember = (defaultValue: boolean) => {
  const remember = shallowRef()
  watch(remember, val => setCache('remember', val, -1, { never: true }))
  remember.value = getRemember(defaultValue)
  return remember
}
